package cn.usian.controller;

import cn.usian.mapper.EmpMapper;
import cn.usian.pojo.Emp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@RestController
public class EmpController {
    @Resource
    private EmpMapper empMapper;

    public List<Emp>findAll(){
        return empMapper.findAll();
    }

    public void add(){
        Emp emp = new Emp();
        emp.setEname("潘金莲");
        emp.setAddress("王大娘对面");
        emp.setBirthday(new Date());
        emp.setHobby("喜欢西门庆");
        empMapper.add(emp);
    }
    public void update(){

        empMapper.update("提莫","约德尔城",1);
    }
    public void delete(Integer eid){
        empMapper.delete(eid);
    }
}
